//
//  ZYSaveModel.m
//  ZYOils
//
//  Created by WANGGNIT on 2019/9/3.
//  Copyright © 2019 WANGGNIT. All rights reserved.
//

#import "ZYSaveModel.h"

@implementation ZYSaveModel

+(id)preferenceWithName:(NSString *)name
{
    if (!name) return nil;
    return [[NSUserDefaults standardUserDefaults] objectForKey:name];
}

+(void)setPreference:(id)ob withName:(NSString *)prefname
{
    if (![ob isKindOfClass:[NSNull class]]) {
        [[NSUserDefaults standardUserDefaults] setValue:ob forKey:prefname];
        //立即将之前设置的Key-Value写入磁盘
        [[NSUserDefaults standardUserDefaults] synchronize];
    }
}

@end
